#ifndef GUI_FRAME
#define GUI_FRAME

#include "font.h"
#include "type.h"
#include "../texture/texture.h"
#include "../core/device/event.h"
#include "../core/engine/reference.h"
#include "../mesh/material.h"

namespace sleek
{
    namespace core
    {
        namespace engine
        {
            class interface;
        }
    }
    namespace gui
    {
        class frame : public core::engine::reference
        {
            public:
                frame(core::engine::interface*);
                virtual ~frame();
                virtual INTERFACE_GUI_CODE getType() { return IGT_FRAME; }

                virtual void addChild(frame*);
                virtual void removeChild(frame*);
                virtual void removeChild(core::s32);
                virtual frame* getChild(core::s32);
                virtual void removeAll();

                virtual void setFont(font*);
                virtual void setVisible(bool);
                virtual void setParent(frame*);
                virtual void setText(core::os::stringc);
                virtual void setScale(core::math::vector2di);

                virtual core::math::aabbox2di getBoundingBox();
                virtual core::math::vector2di getScale();
                virtual core::os::stringc getText();
                virtual frame* getParent();
                virtual bool isVisible();
                virtual font* getFont();

                virtual void move(core::math::vector2di);
                virtual bool manage(core::device::input*);
                virtual void render();
            protected:                frame(){}   font *ft2;
                bool show, isActive;  frame *parent;
                core::engine::interface *mom;
                virtual void renderChild();

                core::math::vector2di relative, absolute, textpos;
                core::math::aabbox2di box;
                core::os::stringc text;

                virtual void UpdateAbsolutePosition();
                virtual void UpdateChildPosition();
                virtual void UpdateFontPos();
            private:
                friend class window;
                friend class theme;
                friend class core::engine::interface;
                core::math::array<frame*> child;
        };
    }
}

#endif
